﻿CREATE TABLE [dbo].[forum_post] (
    [content_item_id]      BIGINT        NOT NULL,
    [forum_id]             BIGINT        NOT NULL,
    [parent_id]            BIGINT        NULL, 
    [modified]             DATETIME      NULL,
    [modified_by_id]       BIGINT        NULL,
    [modification_comment] NVARCHAR (50) NULL,
    [views]                INT           CONSTRAINT [DF__forum_pos__views__3B75D760] DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_forum_post] PRIMARY KEY CLUSTERED ([content_item_id] ASC),
    CONSTRAINT [FK_forum_post_content_item] FOREIGN KEY ([content_item_id]) REFERENCES [dbo].[content_item] ([content_item_id]),
    CONSTRAINT [FK_forum_post_forum] FOREIGN KEY ([forum_id]) REFERENCES [dbo].[forum] ([forum_id]),
    CONSTRAINT [FK_forum_post_forum_post] FOREIGN KEY ([parent_id]) REFERENCES [dbo].[forum_post] ([content_item_id]),
    CONSTRAINT [FK_forum_post_users] FOREIGN KEY ([modified_by_id]) REFERENCES [dbo].[users] ([user_id])
);



